﻿@inherits LayoutComponentBase

<MudThemeProvider IsDarkMode="@IsDarkMode" Theme="CurrentTheme"/>
<MudPopoverProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>

<MudLayout>
    <MudAppBar Elevation="0" Color="Color.Inherit">
        <MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@DrawerToggle"/>
        <MudSpacer/>
        @foreach (var appBarItem in AppBarService.AppBarComponents)
        {
            @appBarItem
        }
    </MudAppBar>
    <MudDrawer @bind-Open="_drawerOpen" Elevation="0" ClipMode="DrawerClipMode.Always">
        <MudDrawerHeader>
            @BrandingProvider.Branding
        </MudDrawerHeader>
        <div class="mt-10">
            <NavMenu/>
        </div>
    </MudDrawer>
    <MudMainContent>
        <ErrorBoundary @ref="@_errorBoundary">
            <ChildContent>
                @Body
            </ChildContent>
            <ErrorContent>
                @if (context is UnauthorizedAccessException)
                {
                    @UnauthorizedComponent
                }
                else
                {
                    @DisplayError(context)
                }
            </ErrorContent>
        </ErrorBoundary>

    </MudMainContent>
</MudLayout>